package com.harisucici.websocketlib.room;

import android.content.Context;

import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;

import com.harisucici.websocketlib.entities.receive.CurrentSessionReceive;

@Database(entities = {CurrentSessionReceive.class}, version = 1, exportSchema = false)
public abstract class CurrentDataBase extends RoomDatabase {
    private static CurrentDataBase currentDataBase;

    public static synchronized CurrentDataBase getInstance(Context context) {
        if (currentDataBase == null) {
            // 构建
            currentDataBase = Room.databaseBuilder(
                    context,
                    CurrentDataBase.class,
                    "current_session").build();
        }
        return currentDataBase;
    }

    public abstract CurrentDao currentDao();
}
